home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: mxsld2.pd.infn.it!LORETI
- From: loreti@mxsld2.pd.infn.it (Maurizio Loreti)
- Subject: Re: Split Filename
- X-Nntp-Posting-Host: mxsld2.pd.infn.it
- Message-ID: <DM23s4.77J@news.cern.ch>
- Sender: news@news.cern.ch (USENET News System)
- Reply-To: loreti@mxsld2.pd.infn.it
- Organization: I.N.F.N. Padova - CDF/CMS VAXcluster
- References: <4e6lsr$8ar@news1.radix.net>,<31075FB4.3E53@cmt.lpr.mail.carel.fi>
- Date: Wed, 31 Jan 1996 17:40:50 GMT
-
- In article <31075FB4.3E53@cmt.lpr.mail.carel.fi>, Ari Lukumies <aril@cmt.lpr.mail.carel.fi> writes:
- >Jim Ward wrote:
- >>
- >> Is there a C function that will split
- >> /home/file.c into /home and file.c ?
- >>
- >> Thanks,
- >>
- >> Jim Ward
- >
- >You could try:
- >
- > char pathandfile[] = "/home/file.c";
- > char *path = pathandfile;
- > char *p = strrchr(pathandfile, '/');
- > char *filename = p + 1;
- > *p = '\0';
- >
- >Also, some systems have functions named makepath and splitpath.
- >
- >Later,
- >AriL
- >
- >
- >--
- >All my opinions are mine and mine alone.
-
- Try with pathhandfile[] = "file.c" ... core dump.
- --
- Maurizio Loreti http://mvxpd5.pd.infn.it/wwwcdf/mlo.html
- Un. of Padova, Dept. of Physics - Padova, Italy loreti@padova.infn.it
-